package com.luckymore.ydd.app.model;

import com.base.model.Bean2Json;

import org.json.JSONArray;

import java.util.ArrayList;
import java.util.List;

public class MAppPost {

	static public class MPost extends Bean2Json<MPost> {
		private static final long serialVersionUID = 1L;
		private String id;
		private String userid;
		private String title;
		private String content;
		private String lastTime;
		private int commentCount;
		private int praiseCount;
		private String nickname;
		private String headimg;
		private String time;
		private String isUnRead;
		private int hasPraise;
		private int sex;
		private String sharedUrl;
		public String getId() {
			return this.id;
		}
		public void setId(String id) {
			this.id=id;
		}
		public String getUserid() {
			return this.userid;
		}
		public void setUserid(String userid) {
			this.userid=userid;
		}
		public String getTitle() {
			return this.title;
		}
		public void setTitle(String title) {
			this.title=title;
		}
		public String getContent() {
			return this.content;
		}
		public void setContent(String content) {
			this.content=content;
		}
		public String getLastTime() {
			return this.lastTime;
		}
		public void setLastTime(String lastTime) {
			this.lastTime=lastTime;
		}
		public int getCommentCount() {
			return this.commentCount;
		}
		public void setCommentCount(int commentCount) {
			this.commentCount=commentCount;
		}
		public int getPraiseCount() {
			return this.praiseCount;
		}
		public void setPraiseCount(int praiseCount) {
			this.praiseCount=praiseCount;
		}
		public String getNickname() {
			return this.nickname;
		}
		public void setNickname(String nickname) {
			this.nickname=nickname;
		}
		public String getHeadimg() {
			return this.headimg;
		}
		public void setHeadimg(String headimg) {
			this.headimg=headimg;
		}
		public String getTime() {
			return this.time;
		}
		public void setTime(String time) {
			this.time=time;
		}
		public String getIsUnRead() {
			return this.isUnRead;
		}
		public void setIsUnRead(String isUnRead) {
			this.isUnRead=isUnRead;
		}
		public int getHasPraise() {
			return this.hasPraise;
		}
		public void setHasPraise(int hasPraise) {
			this.hasPraise=hasPraise;
		}
		public int getSex() {
			return this.sex;
		}
		public void setSex(int sex) {
			this.sex=sex;
		}
		public String getSharedUrl() {
			return this.sharedUrl;
		}
		public void setSharedUrl(String sharedUrl) {
			this.sharedUrl=sharedUrl;
		}
		public MPost build() throws Exception {
			this.setId(data.getString("id_"));
			this.setUserid(data.getString("userid_"));
			this.setTitle(data.getString("title_"));
			this.setContent(data.getString("content_"));
			this.setLastTime(data.getString("lastTime_"));
			this.setCommentCount(data.getInt("commentCount_"));
			this.setPraiseCount(data.getInt("praiseCount_"));
			this.setNickname(data.getString("nickname_"));
			this.setHeadimg(data.getString("headimg_"));
			this.setTime(data.getString("time_"));
			this.setIsUnRead(data.getString("isUnRead_"));
			this.setHasPraise(data.getInt("hasPraise_"));
			this.setSex(data.getInt("sex_"));
			this.setSharedUrl(data.getString("sharedUrl_"));
			return this;
		}
		public void build(Bean2Json data) {
			this.setId(((MPost)data).getId());
			this.setUserid(((MPost)data).getUserid());
			this.setTitle(((MPost)data).getTitle());
			this.setContent(((MPost)data).getContent());
			this.setLastTime(((MPost)data).getLastTime());
			this.setCommentCount(((MPost)data).getCommentCount());
			this.setPraiseCount(((MPost)data).getPraiseCount());
			this.setNickname(((MPost)data).getNickname());
			this.setHeadimg(((MPost)data).getHeadimg());
			this.setTime(((MPost)data).getTime());
			this.setIsUnRead(((MPost)data).getIsUnRead());
			this.setHasPraise(((MPost)data).getHasPraise());
			this.setSex(((MPost)data).getSex());
			this.setSharedUrl(((MPost)data).getSharedUrl());
		}

	}

	static public class MPosts extends Bean2Json<MPosts> {
		private static final long serialVersionUID = 1L;
		private List<MPost> list = new ArrayList<MPost>();
		public List<MPost> getList() {
			return this.list;
		}
		public void setList(List<MPost> list) {
			this.list=list;
		}
		public MPosts build() throws Exception {
			JSONArray jalist = data.getJSONArray("list_");
			for(int i = 0, len = jalist.length(); i < len; i++) {
				MPost n = new MPost();n.setData(jalist.getJSONObject(i));this.list.add(n);
			}
			return this;
		}
		public void build(Bean2Json data) {
			this.setList(((MPosts)data).getList());
		}

	}

	static public class MPostComments extends Bean2Json<MPostComments> {
		private static final long serialVersionUID = 1L;
		private List<MPostComment> comments = new ArrayList<MPostComment>();
		public List<MPostComment> getComments() {
			return this.comments;
		}
		public void setComments(List<MPostComment> comments) {
			this.comments=comments;
		}
		public MPostComments build() throws Exception {
			JSONArray jacomments = data.getJSONArray("comments_");
			for(int i = 0, len = jacomments.length(); i < len; i++) {
				MPostComment n = new MPostComment();n.setData(jacomments.getJSONObject(i));this.comments.add(n);
			}
			return this;
		}
		public void build(Bean2Json data) {
			this.setComments(((MPostComments)data).getComments());
		}

	}

	static public class MPostComment extends Bean2Json<MPostComment> {
		private static final long serialVersionUID = 1L;
		private String id;
		private String pid;
		private String replyid;
		private String replyNickname;
		private String content;
		private String userid;
		private String nickname;
		private String headimg;
		private String time;
		private int isNew;
		private String title;
		private int sex;
		public String getId() {
			return this.id;
		}
		public void setId(String id) {
			this.id=id;
		}
		public String getPid() {
			return this.pid;
		}
		public void setPid(String pid) {
			this.pid=pid;
		}
		public String getReplyid() {
			return this.replyid;
		}
		public void setReplyid(String replyid) {
			this.replyid=replyid;
		}
		public String getReplyNickname() {
			return this.replyNickname;
		}
		public void setReplyNickname(String replyNickname) {
			this.replyNickname=replyNickname;
		}
		public String getContent() {
			return this.content;
		}
		public void setContent(String content) {
			this.content=content;
		}
		public String getUserid() {
			return this.userid;
		}
		public void setUserid(String userid) {
			this.userid=userid;
		}
		public String getNickname() {
			return this.nickname;
		}
		public void setNickname(String nickname) {
			this.nickname=nickname;
		}
		public String getHeadimg() {
			return this.headimg;
		}
		public void setHeadimg(String headimg) {
			this.headimg=headimg;
		}
		public String getTime() {
			return this.time;
		}
		public void setTime(String time) {
			this.time=time;
		}
		public int getIsNew() {
			return this.isNew;
		}
		public void setIsNew(int isNew) {
			this.isNew=isNew;
		}
		public String getTitle() {
			return this.title;
		}
		public void setTitle(String title) {
			this.title=title;
		}
		public int getSex() {
			return this.sex;
		}
		public void setSex(int sex) {
			this.sex=sex;
		}
		public MPostComment build() throws Exception {
			this.setId(data.getString("id_"));
			this.setPid(data.getString("pid_"));
			this.setReplyid(data.getString("replyid_"));
			this.setReplyNickname(data.getString("replyNickname_"));
			this.setContent(data.getString("content_"));
			this.setUserid(data.getString("userid_"));
			this.setNickname(data.getString("nickname_"));
			this.setHeadimg(data.getString("headimg_"));
			this.setTime(data.getString("time_"));
			this.setIsNew(data.getInt("isNew_"));
			this.setTitle(data.getString("title_"));
			this.setSex(data.getInt("sex_"));
			return this;
		}
		public void build(Bean2Json data) {
			this.setId(((MPostComment)data).getId());
			this.setPid(((MPostComment)data).getPid());
			this.setReplyid(((MPostComment)data).getReplyid());
			this.setReplyNickname(((MPostComment)data).getReplyNickname());
			this.setContent(((MPostComment)data).getContent());
			this.setUserid(((MPostComment)data).getUserid());
			this.setNickname(((MPostComment)data).getNickname());
			this.setHeadimg(((MPostComment)data).getHeadimg());
			this.setTime(((MPostComment)data).getTime());
			this.setIsNew(((MPostComment)data).getIsNew());
			this.setTitle(((MPostComment)data).getTitle());
			this.setSex(((MPostComment)data).getSex());
		}

	}


}
